﻿using System;
using System.Text;

namespace Simp.CodeModel
{
	/// <summary>Allows the construction of a <see cref="string"/> without allowing deletion parts of it.</summary>
	/// <remarks>This mechanism makes sure no client using this class can erase the <see cref="string"/>.</remarks>
	public class AppendOnlyStringBuilder
	{
		private readonly StringBuilder _builder = new StringBuilder();

		/// <summary>Appends a <see cref="string"/>.</summary>
		/// <param name="value"></param>
		public void Append(string value)
		{
			_builder.Append(value);
		}

		/// <summary>Returns the constructed <see cref="string"/>.</summary>
		/// <returns></returns>
		public override string ToString()
		{
			return _builder.ToString();
		}
	}
}